package com.rfid.row.convertUtil;

import java.sql.Date;

public class ConvertUtils {

	@SuppressWarnings("unchecked")
	public static <T> T convert(String fieldValue, Class<T> type) throws Exception {
		Object data = null;
		if(Integer.class == type) {
			data = Integer.parseInt(fieldValue);
		}
		if(Date.class == type) {
			data = Date.valueOf(fieldValue);
		}
		if(Long.class == type) {
			data = Long.parseLong(fieldValue);
		}
		if(String.class == type) {
			data = fieldValue;
		}
		if(Boolean.class == type) {
			data = Boolean.getBoolean(fieldValue);
		}
		return (T) data;
	}

}
